package
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.geom.Point;
	import flash.ui.Mouse;
	import flash.ui.MouseCursorData;

	public class Utils
	{
		public function Utils()
		{
		}
		public static function registMouseCursor(name:String,asset:*,hotPoint:Point = null):void
		{
			var vector:Vector.<BitmapData>;
			if(asset is Class)asset = new asset();
			
			if(asset is Bitmap)
			{
				vector = new Vector.<BitmapData>();
				vector.push(asset.bitmapData);
			}else if(asset is BitmapData)
			{
				vector = new Vector.<BitmapData>();
				vector.push(asset);
			}else if(asset is Vector.<BitmapData>)
			{
				vector = asset;
			}else
			{
				trace("register mouse cursor error");
			}
			
			if(hotPoint == null)
			{
				hotPoint = new Point(vector[0].width/2,vector[0].height/2);
			}
			
			var cursorData:MouseCursorData = new MouseCursorData();
			cursorData.data = vector;
			cursorData.hotSpot = hotPoint;
			Mouse.registerCursor(name,cursorData);
		}

	}
}